<!DOCTYPE html>
<html lang="en">
<head>
    <title>团队组建考核报表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .jiaobiao3 {
            position: relative;
        }

        .jiaobiao3 i {
            display: block;
            width: 6px;
            height: 6px;
            background: url("/dist/img/newLog3.png");
            position: absolute;
            top: 0px;
            right: 0px;
        }
        .moduleName {
            height: 28px;
            line-height: 28px;
            font-size: 22px;
            border-bottom: 1px solid #ddd;
            text-align: center;

        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            padding: 10px 0;
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
            overflow: hidden;

        }

        .infoReport {
            display: flex;
            justify-content: flex-start;
            text-align: left;
            margin-left: 10px;
        }

        .infoReport div {
            margin: 0 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineOneNoMore {
            text-align: left;
        }

        .lineOneNoMore span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
        }

        .imgStyle {
            width: 300px;
            height: 400px;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .templateStyle {
            border: 1px solid #ddd;
            /*margin-bottom: 10px;*/
            padding: 0 10px;
        }

        .table > thead > tr > th {
            padding: 0;
        }

        .table > tbody > tr > td {
            /*position: relative;*/
        }

        .selectBox {
            height: 25px;
            margin-bottom: 10px;
        }

        .left {
            width: 150px;
            float: left;
        }

        .right {
            margin-left: 160px;
        }

        .graybg {
            background: #f8f8f8;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="div-td-content-more"><i></i></div>
    <div class="row">
        <div class="left" id="inboxGroup" id="divLeft">
            <div class="box-body no-padding box-border iframeH"
                 style="overflow-y: auto;background: #f7f8fa;">
                <ul class="ztree" id="ztree"></ul>
            </div>
        </div>
        <div class="right">
            <div class="templateStyle iframeH" style="overflow-y: auto;">
                <div class="nav-tabs-custom">
                   <!-- <input type="text" @focus="showDatePicker2($event)" v-model="selectParameter.day"
                           style="width:124px;float: left;  height: 28px; margin-bottom: 10px;">-->
                    <div class="moduleName" style="float: left">团队组建考核报表</div>
                    <ul class="nav nav-tabs pull-right" style="margin-bottom: 10px;" v-cloak>
                        <li class="active" @click="refreshData('selectParameter','getForGroupVacantAndFine',thisMonth)" style="position: relative;left: 10px"><a href="#sales-chart"
                                                                                           data-toggle="tab">本月</a>
                        </li>
                        <li v-for="(item,i) in tab" @click="refreshData('selectParameter','getForGroupVacantAndFine',item.time)" style="position: relative;left: 10px"><a
                                href="#sales-chart" data-toggle="tab">{{i==0?"上月":item.str}}</a>
                        </li>
                        <li style="float: right;margin-top: -2px;">    <input type="button" style="margin-left:10px;margin-top: 2px;width: 60px"
                                       class="btn oaBtn btn-sm pull-left" value="导 出"
                                       @click="exportExcel()"></li>
                    </ul>

                </div>

                <!--集团-->
                <table v-if="isGroup" class="table text-center table-width"
                       style="width: 650px;margin:0 auto;">
                    <thead>
                    <tr>
                        <th rowspan="2" style="width:100px; " class="tableTitle">公司名称</th>
                        <th rowspan="2" style="width:80px; " class="tableTitle">大区</th>
                        <th rowspan="2" style="width: 80px;" class="tableTitle">责任人</th>
                        <th rowspan="2" style="width: 80px;" class="tableTitle">当月罚款</th>
                        <th colspan="3" style="width: 150px;border-bottom: none;" class="tableTitle">区域经理</th>
                        <th colspan="3" style="width: 150px;border-bottom: none;" class="tableTitle">大区经理</th>
                    </tr>
                    <tr>
                        <th style="width: 50px;border-top: none;" class="tableTitle">标配</th>
                        <th style="width: 50px;border-top: none;" class="tableTitle">现有</th>
                        <th style="width: 50px;border-top: none;" class="tableTitle">空缺</th>
                        <th style="width: 50px;border-top: none;" class="tableTitle">标配</th>
                        <th style="width: 50px;border-top: none;" class="tableTitle">现有</th>
                        <th style="width: 50px;border-top: none;" class="tableTitle">空缺</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr v-for="(item,i) in team3.list">
                        <td :rowspan="item.companyNamespan" :class="{hidden: item.companyNamedis}" style="border-right: 1px solid #cbcbcd;">
                            {{item.companyName}}
                        </td>
                        <template v-if="item.jobState != '1'">
                            <td :style="item.regionId==''?'font-weight:bold':''" class="lineOne ">
                                <span v-if="item.regionId==''">{{item.roleName}}</span>
                                <span v-else >{{item.regionName}}</span>
                            </td>
                            <td v-if="item.currentRole=='true'" :style="item.regionId==''?'font-weight:bold':''">{{item.userName}}</td>
                            <!--item.companyId,item.userId,item.roleName-->
                            <td v-else  :style="item.regionId==''?'font-weight:bold;color:gray':'color:gray'" class="jiaobiao3 roleChange" :attrId="item.companyId" :attrUserId="item.userId" :attrName="item.roleName"><i ></i><span>{{item.userName}}</span></td>
                            <td v-if="item.money&&item.money!='-'"
                                :style="item.regionId==''?'font-weight:bold':''"
                                style="color:#228bee;cursor: pointer"
                                @click="openDetail(thisMonth,item.userName,item.companyId,item.regionId,item.userId,item.roleName)">
                                {{item.money==0?'-':item.money}}
                            </td>
                            <td v-else :style="item.regionId==''?'font-weight:bold':''">-</td>
                            <!--人员配置-->
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                {{item.managerTargetNum==0?'-':item.managerTargetNum}}
                            </td>
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                {{item.managerCount==0?'-':item.managerCount}}
                            </td>
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                <span :style="item.managerVacant&&item.managerVacant!='-'?'color: red;':''">{{item.managerVacant==0?'-':item.managerVacant}}</span>
                            </td>
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                {{item.bigManagerTargetNum==0?'-':item.bigManagerTargetNum}}
                            </td>
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                {{item.bigManagerCount==0?'-':item.bigManagerCount}}
                            </td>
                            <td :style="item.regionId==''?'font-weight:bold':''">
                                <span :style="item.bigManagerVacant&&item.bigManagerVacant!='-'?'color: red;':''"> {{item.bigManagerVacant==0?'-':item.bigManagerVacant}}</span>
                            </td>
                        </template>
                        <template v-else>
                            <td  class="lineOne " style="background-color:#f5f5f5;">
                                <span v-if="item.regionId==''">{{item.roleName}}</span>
                                <span v-else >{{item.regionName}}</span>
                            </td>
                            <td v-if="item.currentRole=='true'" style="background-color:#f5f5f5;" class="jiaobiao3 jobStateChange"  :attrUserId="item.userId">
                                <i ></i><span>{{item.userName}}</span>
                            </td>
                            <!--item.companyId,item.userId,item.roleName-->
                            <td v-else style="background-color:#f5f5f5;"  class="jiaobiao3 jobStateChange"  :attrUserId="item.userId" >
                                <i ></i><span>{{item.userName}}</span>
                            </td>
                            <td v-if="item.money&&item.money!='-'"
                                style="background-color:#f5f5f5;cursor: pointer"
                                @click="openDetail(thisMonth,item.userName,item.companyId,item.regionId,item.userId,item.roleName)">
                                {{item.money==0?'-':item.money}}
                            </td>
                            <td v-else style="background-color:#f5f5f5;">-</td>
                            <!--人员配置-->
                            <td style="background-color:#f5f5f5;">
                                {{item.managerTargetNum==0?'-':item.managerTargetNum}}
                            </td>
                            <td style="background-color:#f5f5f5;">
                                {{item.managerCount==0?'-':item.managerCount}}
                            </td>
                            <td style="background-color:#f5f5f5;">
                                <span :style="item.managerVacant&&item.managerVacant!='-'?'color: red;':''">
                                    {{item.managerVacant==0?'-':item.managerVacant}}
                                </span>
                            </td>
                            <td style="background-color:#f5f5f5;">
                                {{item.bigManagerTargetNum==0?'-':item.bigManagerTargetNum}}
                            </td>
                            <td style="background-color:#f5f5f5;">
                                {{item.bigManagerCount==0?'-':item.bigManagerCount}}
                            </td>
                            <td style="background-color:#f5f5f5;">
                                <span :style="item.bigManagerVacant&&item.bigManagerVacant!='-'?'color: red;':''"> {{item.bigManagerVacant==0?'-':item.bigManagerVacant}}</span>
                            </td>
                        </template>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script type="text/javascript">
    var zTreeCallback = {
        showIcon: function (treeeId, treeNode) {
            return treeNode.isParent;
        },
        onClick: function (event, treeId, treeNode) {
            console.log(treeNode)
            if (treeNode.id == '201712161613432EAF27DBCCB7D0E6CA') {
                console.log(treeNode.id)
                //滚滚向前集团
                app.selectParameter.companyId = '';
                //app.isGroup = true;
                app.getForGroupVacantAndFine()
            } else {
                app.selectParameter.companyId = treeNode.id;
                app.getForGroupVacantAndFine()
                //app.isGroup = false;
                // app.getAchievementByCompany();
                // app.getList();
            }

        },
        beforeClick: function (treeId, treeNode, clickFlag) {
             if(getCurrentUser().companyId!='201712161613432EAF27DBCCB7D0E6CA'&&treeNode.level==0){
                  return false;
              }
        }
    };
    var zTreeSetting = {
        view: {
            showIcon: zTreeCallback.showIcon
        },
        data: {
            simpleData: {
                enable: true
            },
            keep: {
                parent: true
            }
        },
        callback: {
            onClick: zTreeCallback.onClick,
            beforeClick: zTreeCallback.beforeClick
        }
    };

</script>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo,.lineF", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    var app = new Vue({
        el: '#app',
        data: {
            roleChangeDate:'',
            leaveDate:'',
            leavePostDate:'',
            tab: [],
            time:new Date().Format("yyyy-MM"),
            back: false,
            isGroup: true,
            a: [],
            thisMonth: new Date().Format("yyyy-MM"),
            day: new Date().Format("yyyy-MM-dd"),//今天
            team: {
                tableData: [],
                all: {}
            },
            team2: {
                list: [],
                all: {}
            },
            team3: {
                list: [],
                all: {}
            },
            selectParameter: {
                companyId: "",
                day: new Date().Format("yyyy-MM")//今天
            }
        },
        methods: {
            //获取岗位结束日期
            getRoleChangeDate:function(companyId,userId,roleName){
                var that = this;
                $.wyui.postMethod(urlConfig.warNewspaper.bigAchievements.getRoleChangeDate,{'companyId':companyId,'userId':userId,'roleName':roleName}, function (data) {
                    console.log(data)
                   that.roleChangeDate=data.day;
                });
            },
            //获取用户离职日期
            getLeaveByUserId:function(userId){
                var that = this;
                $.wyui.postMethod(urlConfig.system.user.getLeaveByUserId, {'userId':userId,}, function (data) {
                    console.log(data);
                    that.leaveDate = data.leaveDate;
                    that.leavePostDate = data.leavePostDate;
                });
            },
            //格式化日期
            insert_flg: function (str, flg, sn, type) {
                var newstr = "";
                for (var i = 0; i < str.length; i += sn) {
                    var tmp = str.substring(i, i + sn);
                    newstr += tmp + flg;
                }
                newstr = newstr.substr(0, newstr.length - 1);
                var st1 = newstr.substr(2, 2);
                var st2 = newstr.substr(5, 2);
                var newstr3 = st2 + "/" + st1;
                var obj = {str: newstr, time: newstr};
                return obj;
            },
            getLastEndMonth: function (beginYearMonth) {
                var strYear = parseInt(beginYearMonth.substr(0, 4), 10);
                var strMonth = parseInt(beginYearMonth.substr(4, 6), 10);
                if (strMonth - 1 == 0) {
                    strYear -= 1;
                    strMonth = 12;
                } else {
                    strMonth -= 1;
                }
                if (strMonth < 10) {
                    strMonth = "0" + strMonth;
                }
                var monthstr = strYear + "" + strMonth;
                return monthstr;
            },
            //获取tab
            getTab: function () {
                var that = this;
                var dateTime = new Date().Format("yyyyMM");

                for (var i = 0; i < 5; i++) {
                    dateTime = that.getLastEndMonth(dateTime);
                    that.tab.push(that.insert_flg(dateTime, "-", "4"))
                }
                console.log(that.tab)
            },
            //tab中点击日期刷新对应数据
            refreshData: function (dataType, fun, time) {
                var that = this;
                that[dataType].day = time;
                that[fun]();
            },
            showDatePicker2: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.selectParameter.day = dp.cal.getNewDateStr();
                        that.time = dp.cal.getNewDateStr();
                        that.getForGroupVacantAndFine();
                        return true;
                    },
                    dateFmt: 'yyyy-MM'
                });
                $(e.target).blur();
            },
            //初始化时间控件
            showDatePicker: function (e,type) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.selectParameter.dateTime = dp.cal.getNewDateStr();
                        return true;
                    },
                    dateFmt:'yyyy-MM'
                });
                $(e.target).blur();
            },
            exportExcel:function () {
                var that = this;
                $('#ifExprot').attr('src', server.ip
                    + "/bigAchievements/getDownByCondition.json"
                    + '?companyId=' + that.selectParameter.companyId
                    + "&&day=" + that.selectParameter.day
                );

            },

            //获取合计
            getCount: function (arr, key, type) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    if (!arr[i].changeColor) {
                        number += Number(arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0);
                    }

                }
                return number;
            },
            //合并单元格
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //初始化时间控件
            showDatePicker: function (e, type) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.selectParameter.day = dp.cal.getNewDateStr();
                        return true;
                    },
                    maxDate: new Date().Format("yyyy-MM-dd")//今天
                });
                $(e.target).blur();
            },
            //获取树
            getTreeData: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.system.system.getCompanyTree, {
                    companyId: getCurrentUser().companyId,
                    userId:getCurrentUser().id
                }, function (nodes) {
                    console.log(nodes)
                    for (var i = 0; i < nodes.length; i++) {
                        if (nodes[i].name == '重庆迎风') {
                            nodes.splice(i, 1);
                        }
                    }
                    for (var b = 0;b < nodes.length; b++) {
                        if (nodes[b].name == '江苏灜沣') {
                            nodes.splice(b, 1);
                        }
                    };
                    that.treeObj = $.fn.zTree.init($("#ztree"), zTreeSetting, nodes);
                    var treeObj = $.fn.zTree.getZTreeObj("ztree");
                    var nodes = treeObj.getNodes();
                    console.log(nodes)
                    if (nodes[0].children[0]) {
                        if(getCurrentUser().companyId == '201712161613432EAF27DBCCB7D0E6CA'){
                            treeObj.selectNode(nodes[0]);
                            that.selectParameter.companyId = '';
                        }else{
                            treeObj.selectNode(nodes[0].children[0]);
                            that.selectParameter.companyId = nodes[0].children[0].id;
                        }

                        that.getForGroupVacantAndFine();
                    }
                });
            },
            getList: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.warNewspaper.bigAchievements.getPeopleFineByCompanyId, that.selectParameter, function (data) {
                    console.log(data)
                    var data = trimRN2(data).records;
                    var a = [];

                    function isZai(userName, userMoney) {
                        for (var i = 0; i < a.length; i++) {
                            if (userName === a[i].userName) {
                                if (userMoney == a[i].userMoney) {
                                    return true;
                                }
                            }
                        }
                    }

                    for (var i = 0; i < data.length; i++) {
                        if (i == 0) {
                            a.push({"userName": data[i].userName, "userMoney": data[i].dayMoney})

                        } else {
                            if (isZai(data[i].userName, data[i].dayMoney)) {
                                data[i].changeColor = 'gray';
                            } else {
                                a.push({
                                    "userName": data[i].userName,
                                    "userMoney": data[i].dayMoney
                                })
                            }
                        }


                    }
                    console.log(data)
                    that.team2.list = that.tablesMergeCell(data);
                    that.team2.all.dayMoney = that.getCount(that.team2.list, "dayMoney", true);
                    that.team2.all.monthMoney = that.getCount(that.team2.list, "monthMoney", true);
                });
            },
            getAchievementByCompany: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.warNewspaper.userAchievements.getAchievementByCompany, {
                    companyId: that.selectParameter.companyId,
                }, function (data) {
                    console.log(data)
                    var data = trimRN2(data);
                    that.team.tableData = that.tablesMergeCell(data);
                    that.team.all.managerTargetNum = that.getCount(that.team.tableData, "managerTargetNum");
                    that.team.all.managerCount = that.getCount(that.team.tableData, "managerCount");
                    that.team.all.managerVacant = that.getCount(that.team.tableData, "managerVacant");
                    that.team.all.bigManagerTargetNum = that.getCount(that.team.tableData, "bigManagerTargetNum");
                    that.team.all.bigManagerCount = that.getCount(that.team.tableData, "bigManagerCount");
                    that.team.all.bigManagerVacant = that.getCount(that.team.tableData, "bigManagerVacant");
                });
            },
            /*获取罚款明细*/
            openDetail: function (dateTime, userName, companyId, bigRegionId, userId, roleName) {
                var that = this;
                var month=that.selectParameter.day;
                top.$.dialog({
                    content: 'url:/page/reportForm/warNewspaper/detail.html?dateTime=' + month + '&companyId=' + companyId + '&bigRegionId=' + bigRegionId + '&userId=' + userId + '&userName=' + userName + '&roleName=' + roleName,
                    title: '罚款明细',
                    width: 600,
                    height: 400,
                    max: true,
                    min: true,
                    lock: true
                });

            },
            /*获取整个集团空缺人数及罚款*/
            getForGroupVacantAndFine: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.warNewspaper.bigAchievements.getForGroupVacantAndFine, that.selectParameter, function (data) {
                    console.log(data)
                    var records = data.records;
                    that.team3.list = that.tablesMergeCell(records);
                });
            },
        },

        mounted: function () {
            var that = this;
            //1.获取前5个月的tab数据
            this.getTab();
            that.getTreeData();
        }
    });

</script>
<script>
    $("body").on("mouseenter", ".roleChange", function (e) {
        var that = this;
        clearTimeout(timer);
        timer = setTimeout(function () {
            var top = 0;
            if (jQuery(window).height() + jQuery(window).scrollTop() > ($(that).offset().top + $(that).outerHeight() + 200)) {
                top = 0;
            } else {
                top = "-170px"
            }
            $.ajax({
                url: server.ip + urlConfig.warNewspaper.bigAchievements.getRoleChangeDate,
                type: "POST",
                data: JSON.stringify(
                    {
                        companyId: $(that).attr("attrId"),
                        userId: $(that).attr("attrUserId"),
                        roleName: $(that).attr("attrName")
                    }
                ),
                success: function (r) {
                    if (!r.e.code) {
                        var roleChangeDate=r.data.sendData.day;
                        console.log(roleChangeDate)
                        userHtml.push("<div class='roleChanges' style='position: absolute;left: 0;top: 0;width: 150px;z-index: 999;'>");
                        userHtml.push("<div class='bgf9' style='position: relative;left: 60%;border: 1px solid #000;'>");
                        userHtml.push("<div class='description-block'>");
                        userHtml.push("<h5 class='description-header'>该职位截止日期</h5>");
                        userHtml.push("<span class='description-text'>"+roleChangeDate+"</span>");
                        userHtml.push("</div>");
                        userHtml.push("</div>");
                        $(that).append(userHtml.join(""));
                    } else {
                        alert(r.e.desc);
                    }
                }

            });
            e.stopPropagation();
        }, 500)
    });
    $("body").on("mouseleave", ".roleChange", function (e) {
        clearTimeout(timer);
        $(".roleChanges").remove();
        userHtml= new Array();
    });
</script>
<script>
    $("body").on("mouseenter", ".jobStateChange", function (e) {
        var that = this;
        clearTimeout(timer);
        timer = setTimeout(function () {
            var top = 0;
            if (jQuery(window).height() + jQuery(window).scrollTop() > ($(that).offset().top + $(that).outerHeight() + 200)) {
                top = 0;
            } else {
                top = "-170px"
            }
            $.ajax({
                url: server.ip + urlConfig.system.user.getLeaveByUserId,
                type: "POST",
                data: JSON.stringify(
                    {
                        userId: $(that).attr("attrUserId"),
                    }
                ),
                success: function (r) {
                    if (!r.e.code) {
                        var leaveDate= r.data.sendData[0].leaveDate;
                        console.log(r.data.sendData)
                        userHtml.push("<div class='jobStateChanges' style='position: absolute;left: 0;top: 0;width: 150px;z-index: 999;'>");
                        userHtml.push("<div class='bgf9' style='position: relative;left: 60%;border: 1px solid #000;'>");
                        userHtml.push("<div class='description-block'>");
                        userHtml.push("<h5 class='description-header'>该用户离职日期</h5>");
                        userHtml.push("<span class='description-text'>"+leaveDate+"</span>");
                        userHtml.push("</div>");
                        userHtml.push("</div>");
                        $(that).append(userHtml.join(""));
                    } else {
                        alert(r.e.desc);
                    }
                }

            });
            e.stopPropagation();
        }, 500)
    });
    $("body").on("mouseleave", ".jobStateChange", function (e) {
        clearTimeout(timer);
        $(".jobStateChanges").remove();
        userHtml= new Array();
    });
</script>
</body>